﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebPortal.Models.ViewModel.GoodsList>" %>

<asp:Content ID="CSS" ContentPlaceHolderID="StylesContainer" runat="server">
    <link href="../../Content/Admin.css" rel="stylesheet" type="text/css" />
</asp:Content>

<asp:Content ID="JS" ContentPlaceHolderID="ScriptContainer" runat="server">
    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../../Scripts/admin.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.md5.js"></script>
    <script type="text/javascript" src="../../Scripts/cookie.js"></script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Goods edit
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<% for (int i = 0; i < Model.goods.Count; i++)
    { %>
    <div class="good-edit">
    <a class="edit edit-name"><%:Model.goods[i].Name%></a> | 
        <form action="/Goods/Delete" method="post">
            <input type="hidden" name="goodID" value="<%:Model.goods[i].GoodID%>" />
            <input type="submit" class="delete-good" value="Delete" />
        </form>    
    </div>
<% } %>

<div class="cat-edit">
    <a class="edit edit-name">Add a new good</a>
    <form action="/Goods/Add" method="post" enctype="multipart/form-data">
    <table><tr>
        <td>Name</td>
        <td>Description</td>
        <td>Picture</td>
        <td>Cetegory</td>
        <td></td>
    </tr><tr>
        <td><input name="name" value="" /></td>
        <td><input name="description" value="" /></td>
        <td><input name="picture" type="file" /></td>
        <td><select name="categoryID">
            <% for (int i = 0; i < Model.categories.Count; i++) { %>
            <option value="<%:Model.categories[i].CategoryID%>"> <%:Model.categories[i].Name%> </option>
            <% } %>
        </select></td>
        <td><input type="submit" name="submit" value="Save" /></td>
    </tr></table>
    </form>
 </div>
</asp:Content>
